import { fileURLToPath, URL} from 'node:url'
import fs from 'node:fs'
import path from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  // server: {
  //   host: `192.168.0.147`,
  //   // https: {
  //   //    cert: fs.readFileSync(path.join(__dirname, 'certs/www.duxingzhe.top.pem')),
  //   //    key: fs.readFileSync(path.join(__dirname, 'certs/www.duxingzhe.top.key')),
  //   //   }
  // },
  plugins: [
      vue(),
    // ...
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
